<?php

vendor('dBug');
class TestAction extends Action{
    public function index(){
        dump(strtotime('2011-7-05'));
        dump(date( DATE_ATOM,mktime(0, 0, 0, $month, $day, $year)));
        dump(date( DATE_ATOM,mktime(0, 0, 0, 11, 1, 2000)));
        
        dump(date( DATE_ATOM,mktime(0, 0, 0, 11, 31, 2000)));
        dump(date( DATE_ATOM,mktime(24, 0, 0, 11, 1, 2000)));
        dump(date( DATE_ATOM,mktime(0, 0, 0, 11, 0, 2000)));
        dump(date( DATE_ATOM,mktime(24, 0, 0, 11, 0, 2000)));
        
        $this->error("stop here for test");
    }
	public function constants(){
        echo('__URL__= ');   new dBug(__URL__);
        echo('__ACTION__= ');   new dBug(__ACTION__);
        echo('__SELF__= ');   new dBug(__SELF__);
    }
    public function submitID(){
        echo("<form action='".__ACTION__."' method='get'>");
        echo("<input type='text' id='tt' value=''/>");
        echo("</form>");
    }
    public function testL(){
        new dBug(L());
    }
    public function testPHP(){
        $x= strlen(null);
        dump($x);
    }
    public function testWhere(){
        $E= M('Event');
        $e= $E->where('id>=100')->count();
        dump($e);
    }
    public function testMultiInsert(){
        $ET= M('EventTag');
        $data= array(
            'eid'=> 100,
            'tag'=> 'holy test',
        );
        $data2= array(
            'eid'=> 100,
            'tag'=> 'holy test2',
        );
        
        $ET->data($data,$data2);
        $ET->add();
    }
    public function insertEvent(){
        $uid= 2;
        //for($i=0; $i<40; $i++){
        for($i=1; $i<40; $i++){
            $data=array(
                'id'=>(200+$i),
                'author_id'=>1135,
                'title'=>'测试测试活动'.$i,
                'content'=>str_repeat('测试', ($i/10)),
                'time_start'=>date('Y-m-i H:i:s', strtotime('2011-1-11 +'.$i.' DAY')),
                'location'=>'测试地点'.$i,
                'img'=>'event.jpg',
                'type'=>($i/10),
            );
            $Event= new EventModel();
            dump($data);
            $eid= $Event->create($data);
            dump($eid);
            $eid= $Event->add($data);
            if ($eid){
                //TimelineModel::factor('TYPE_EVENT', $uid, $eid, $data['title'])->add();
            }
        }
        $this->error($Event->getError());
    }
}
?>